<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网格布局</title>
</head>
<body>
    <style>.grid-container {
        display: grid;
        grid-template-columns: auto auto auto; /* 三列等宽 */
        gap: 10px; /* 单元格之间的间隔 */
        padding: 10px; /* 网格容器的内边距 */
    }
    
    .grid-item {
        background-color: rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(0, 0, 0, 0.8);
        padding: 20px;
        font-size: 30px;
        text-align: center;
    }
    
    .item1 { background-color: red; }
    .item2 { background-color: orange; }
    .item3 { background-color: yellow; }
    .item4 { background-color: green; }
    .item5 { background-color: blue; }
    .item6 { background-color: indigo; }
    .item7 { background-color: violet; }
    .item8 { background-color: pink; }
    .item9 { background-color: brown; }</style>
    <div class="grid-container">
        <div class="grid-item item1">1</div>
        <div class="grid-item item2">2</div>
        <div class="grid-item item3">3</div>
        <div class="grid-item item4">4</div>
        <div class="grid-item item5">5</div>
        <div class="grid-item item6">6</div>
        <div class="grid-item item7">7</div>
        <div class="grid-item item8">8</div>
        <div class="grid-item item9">9</div>
        
    </div>
</body>
</html>